#!/sbin/openrc-run
supervisor=supervise-daemon

name="solid-community-server"
description="Daemon for solid-community-server, a Solid pod server"

: ${config_file:="/usr/share/webapps/solid-community-server/config/file.json"}
: ${storage_path:="/var/lib/solid-community-server"}

command="/usr/bin/solid-community-server"
command_args="-c $config_file -f $storage_path"
command_user=solid:solid
log_dir="/var/log/solid-community-server"
log_file="$log_dir/server.log"
supervise_daemon_args="--chdir $storage_path --stdout $log_file --stderr $log_file"

depends() {
	use logger
	need net localmount
}

start_pre() {
	checkpath -d -o solid "$storage_path"
	checkpath -d -o solid "$log_dir"
	checkpath -f -o solid "$log_file"
}
